package cn.itsource.pethome.mylistener;

import cn.itsource.pethome.system.permission.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener//让springboot启动的时候知道
public class PermissionScanInitListener implements ServletContextListener {
    @Autowired
    private IPermissionService permissionService;
    /**
     * 初始执行
     * @param sce
     */
    @Override
    public void contextInitialized(ServletContextEvent sce) {

        //你要做多久？？？？ 花费很多的时间
        //线程
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("权限初始化开始******************************************");
               /* permissionService.autoExecuteScan();*/
                System.out.println("权限初始化结束******************************************");
            }
        }).start();//启动线程

    }
}
